// api/user.ts
export interface User {
  id: number;
  name: string;
  age: number;
}

export interface UserResponse {
  total: number;
  list: User[];
}

export function getUserList(params: { current: number; pageSize: number }): Promise<UserResponse> {
  return new Promise((resolve) => {
    setTimeout(() => {
      const total = 50;
      const list: User[] = Array.from({ length: params.pageSize }, (_, i) => ({
        id: (params.current - 1) * params.pageSize + i + 1,
        name: `User ${(params.current - 1) * params.pageSize + i + 1}`,
        age: 20 + (i % 10),
      }));
      resolve({ total, list });
    }, 500);
  });
}
